﻿using System;
using NUnit.Framework;
using ProjetoComperio.BusinessLogicLayer;
using ProjetoComperio.DataLayer.Entities;

namespace ProjetoComperio.Test.BusinessLogicLayer
{
    [TestFixture]
    public class SubjectBLLTest
    {
        private SubjectBLL subjectBLL;

        [TestFixtureSetUp]
        public void TestFixtureSetUp()
        {
            subjectBLL = new SubjectBLL();
        }

        [Test]
        public void TestCreateWithValidObject()
        {
            var subject = new Subject
            {
                Title = "TitleTeste",
                Message = "MessageTeest",
                CreatedDate = DateTime.Now,
                ContributionID = 1,
                UserName = "testUser@comperio.com"
            };

            subjectBLL.Create(subject);
            Assert.IsTrue(subject.SubjectID != 0);
        }

        [Test]
        [ExpectedException(typeof(System.Data.UpdateException))]
        public void TestCreateWithInvalidObject()
        {   
            subjectBLL.Create( new Subject());
        }

    }
}
